<template>
  <slot>
    <div>
      <p> {{ list[0] }}</p>
      <p> {{ list[1] }}</p>
      <p> {{ list[2] }}</p>
    </div>
  </slot>
  <a-popover :position="position">
    <div class="auth-nums" v-if="list.length > 3">+{{ list.length - 3 }}</div>
    <template #content>
      <div class="pop-orgs">
        <div class="total-amount">总金额：{{ totalAmount }} </div>
        <a-scrollbar :style="{ 'max-height': '200px', overflow: 'auto', 'max-width': maxWidth }">
          <div v-for="(item, index) of list" :key="index" class="list">
            <slot name="content-item" :item="item">{{ item }}</slot>
          </div>
        </a-scrollbar>
      </div>
    </template>
  </a-popover>
</template>
<script setup>
  defineProps({
    maxWidth: {
      type: String,
      default: 'auto',
    },
    list: {
      type: Array,
      default: () => [],
    },
    totalAmount: {
      type: String,
      default: '',
    },
    position: {
      type: String,
      default: 'top',
    },
  })
</script>
<style lang="less" scoped>
  .auth-nums {
    display: inline-block;
    background-color: #1890ff;
    border-radius: 10px;
    padding: 0 7px;
    color: #fff;
    margin-left: 3px;
  }
  .total-amount {
    margin-bottom: 10px;
  }
  .pop-orgs {
    max-width: 760px;
    display: flex;
    flex-direction: column;
    .list {
      margin-right: 10px;
      margin-bottom: 10px;
      padding: 2px 6px;
      border-radius: 2px;
      color: #1d2129;
      word-break: break-all;
    }
  }
</style>
